package com.nchu.student_score.controller;

import com.github.pagehelper.PageInfo;
import com.nchu.student_score.dataObject.GradeResult;
import com.nchu.student_score.model.Appeal;
import com.nchu.student_score.service.AppealService;
import com.nchu.student_score.service.GradeService;
import com.nchu.student_score.vo.ResultVo;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/appeal")
public class AppealController {
    @Resource
    AppealService appealService;

    @RequestMapping("adminUpdateAppeal")//教师审批申诉
    public ResultVo<Appeal> adminUpdateAppeal(@RequestBody Appeal input){
        return appealService.adminUpdateAppeal(input);
    }

    @RequestMapping("teacherUpdateAppeal")//教师审批申诉
    public ResultVo<Appeal> teacherUpdateAppeal(@RequestBody Appeal input){
        return appealService.teacherUpdateAppeal(input);
    }

    @RequestMapping("teacherGetOneGrade")
    public ResultVo<GradeResult> appealGetOneGrade(@RequestBody Appeal input){
        return appealService.appealGetOneGrade(input);
    }

    @RequestMapping("stuUpdateAppeal")//提交/更改申诉
    public ResultVo<Appeal> stuInsertOrUpdateAppeal(@RequestBody Appeal input){
        return appealService.stuInsertOrUpdateAppeal(input);
    }

    @RequestMapping("getAppeals/{currPage}")
    public PageInfo<Appeal> getAppealList(@RequestBody Appeal input,@PathVariable Integer currPage){
        return appealService.getAppealList(input,currPage);
    }
}
